package com.acol.util;

import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;

/**
 * @author pcasaes
 * @since 27/10/2006
 *
 */
public class HashOrderedMap extends HashMap {

	private ArraySet keys = new ArraySet();
	/**
	 * 
	 */
	public HashOrderedMap() {
		super();
	}
	/**
	 * @param initialCapacity
	 */
	public HashOrderedMap(int initialCapacity) {
		super(initialCapacity);
	}
	/**
	 * @param initialCapacity
	 * @param loadFactor
	 */
	public HashOrderedMap(int initialCapacity, float loadFactor) {
		super(initialCapacity, loadFactor);
	}
	/**
	 * @param m
	 */
	public HashOrderedMap(Map m) {
		super(m);
	}
	
	
	
	/**
	 * @see java.util.Map#keySet()
	 */
	public Set keySet() {
		return keys;
	}
	/**
	 * @see java.util.Map#put(java.lang.Object, java.lang.Object)
	 */
	public Object put(Object key, Object value) {
		keys.add(key);
		return super.put(key, value);
	}
}


class ArraySet extends ArrayList implements Set {
	
	/**
	 * 
	 */
	public ArraySet() {
		super();
	}
	/**
	 * @param initialCapacity
	 */
	public ArraySet(int initialCapacity) {
		super(initialCapacity);
	}
	/**
	 * @param c
	 */
	public ArraySet(Collection c) {
		super(c);
	}
	
	
}